//点击外面的更新按钮时，获取之前的数据
const express = require('express')

const route = express.Router()

const advModel = require('../db/model/advModel')

route.get('/getUpdateData',async(req,res)=>{
     const {_id} =req.query
    
     //去数据库查询当前id对应的数据
   try{  
    const findResult = await advModel.findOne({_id})
    //把查询到的值响应给前端
    res.send({
        code:10000,
        msg:'更新数据前查询成功',
        data:findResult
    })
     }catch(e){
        console.log('更新数据前查询失败'+e.message)
        res.send({
            code:10001,
            msg:'更新数据前查询失败'+e.message,
            data:null
        })
    }

})

module.exports = route